package com.blogWebAutoTest.common;

import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

import java.time.Duration;

/**
 * Created with IntelliJ IEDA.
 * Description:
 * User:86186
 * Date:2024-03-24
 * Time:16:15
 */
public class AutotestUtils {
    public static ChromeDriver driver;

    //创建驱动对象
    public static ChromeDriver createDtiver(){
        //驱动对象已经创建好了/没有创建
        if (driver == null){
            driver = new ChromeDriver();
            //创建隐式等待,让其作用于整个作用域，不要出现代码渲染过慢而找不到元素
            driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));

        }
        return driver;
    }
}
